package com.example.administrator.youlu.fragment;

import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.example.administrator.youlu.R;

public abstract class BaseFragment extends Fragment {

    protected LinearLayout actionBar;

    public void setActionBar(int leftId,String textTitle,int rightId){

        if (actionBar==null){
            return;
        }
        ImageView leftIv=actionBar.findViewById(R.id.iv_Left);
        ImageView rightIv=actionBar.findViewById(R.id.iv_right);
        ImageView textIv=actionBar.findViewById(R.id.tv_title);
        if (leftId>0){
            leftIv.setVisibility(View.VISIBLE);
            leftIv.setImageAlpha(leftId);
        }else {
            leftIv.setVisibility(View.INVISIBLE);
        }
        if (rightId>0){
            rightIv.setVisibility(View.VISIBLE);
            rightIv.setImageAlpha(rightId);
        }else {
            rightIv.setVisibility(View.INVISIBLE);
        }
        if (!TextUtils.isEmpty(textTitle)){
            textIv.setVisibility(View.VISIBLE);
            textIv.setTag(textIv);
        }else {
            textIv.setVisibility(View.INVISIBLE);
        }
    }
    public abstract void intiView();
}
